package com.gljx.web.service.impl;


import com.gljx.web.Entity.FillingCardRecharge;
import com.gljx.web.dao.CommonDao;
import com.gljx.web.dao.FillingCardRechargeMapper;
import com.gljx.web.service.FillingCardRechargeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
@Transactional
public class FillingCardRechargeServiceImpl extends CommonDao implements FillingCardRechargeService {

	@Autowired
	private FillingCardRechargeMapper fillingCardRechargeMapper;
	
	/**
	 * 根据时间和加油公司查询加油卡充值记录
	 */
	@Override
	public List<FillingCardRecharge> selFillingCardRecharge(Map<String, Object> map) {
		// TODO Auto-generated method stub
		return fillingCardRechargeMapper.selFillingCardRecharge(map);
	}

	/**
	 * 查询期初加油充值
	 */
	@Override
	public Double selFillingCardBeginBalance(Map<String, Object> map) {
		// TODO Auto-generated method stub
		return fillingCardRechargeMapper.selFillingCardBeginBalance(map);
	}


	@Override
	public Map<String, Object> selectPageCount(String psql) {
		// TODO Auto-generated method stub
		Map<String, Object> paramMap = new HashMap<String, Object>();
        paramMap.put("Psql", psql);
        paramMap.put("Pcount", oracle.jdbc.OracleTypes.INTEGER);
        this.getSqlSession().select("com.gljx.web.dao.FillingCardRechargeMapper.pagecount", paramMap, null);
        return paramMap;
	}

	@Override
	public Map<String, Object> selectPage(int pindex, String psql, int psize) {
		// TODO Auto-generated method stub
		Map<String, Object> paramMap = new HashMap<String, Object>();
        paramMap.put("Pindex", pindex);
        paramMap.put("Psql", psql);
        paramMap.put("Psize", psize);
        paramMap.put("Pcount", oracle.jdbc.OracleTypes.INTEGER);
        paramMap.put("v_cur", oracle.jdbc.OracleTypes.CURSOR);
        this.getSqlSession().select("com.gljx.web.dao.FillingCardRechargeMapper.pagemap", paramMap, null);
        return paramMap;
	}


	@Override
	public Double selFillingCardBeginBalances(Map<String, Object> map) {
		// TODO Auto-generated method stub
		return fillingCardRechargeMapper.selFillingCardBeginBalances(map);
	}

	@Override
	public String selectFnumber(String companyId) {
		// TODO Auto-generated method stub
		return fillingCardRechargeMapper.selectFnumber(companyId);
	}

	@Override
	public int addFillingCardRecharge(FillingCardRecharge fillingCardRecharge) {
		// TODO Auto-generated method stub
		return fillingCardRechargeMapper.insertSelective(fillingCardRecharge);
	}

	@Override
	public int deleteFillingCardRechargeByFid(String fid) {
		// TODO Auto-generated method stub
		return fillingCardRechargeMapper.deleteByPrimaryKey(fid);
	}

	@Override
	public FillingCardRecharge selFillingCardRechargeByFid(String fid) {
		// TODO Auto-generated method stub
		return fillingCardRechargeMapper.selFillingCardRechargeByFid(fid);
	}

	@Override
	public int updateFillingCardRecharge(FillingCardRecharge fillingCardRecharge) {
		// TODO Auto-generated method stub
		return fillingCardRechargeMapper.updateByPrimaryKeySelective(fillingCardRecharge);
	}

	@Override
	public List<FillingCardRecharge> selectFillingCardRecharge(String companyId, String fnumber, String fdescription, String beginTime, String endTime) {
		Map<String,String> map =new HashMap<String,String>();
		map.put("companyId",companyId);
		map.put("fnumber",fnumber);
		map.put("fdescription",fdescription);
		map.put("beginTime",beginTime);
		map.put("endTime",endTime);
		return fillingCardRechargeMapper.selectFillingCardRecharge(map);
	}


}
